{extend name="public/base"/}
{block name="style"}
<script type="text/javascript" src="/public/lboyue/m/sitejs/book.js?v=20181123"></script>
<script type="text/javascript">

    $(document).ready(function () {


        $('.moreIco').click(function () {

            if($(this).hasClass('closeIco')){

                $('#header').removeClass('app_headerFixed2');
                $(this).removeClass('closeIco');
                $('.app_header_second').hide();
                $('.app_meskSection').hide();

            }else{

                $('#header').addClass('app_headerFixed2');
                $(this).addClass('closeIco');
                $('.app_header_second').show();
                $('.app_meskSection').show();
            }



        })

        $('body').on('click','.app_meskSection',function () {
            $('.app_header_second').hide();
            $('.app_meskSection').hide();
            $('#header').removeClass('app_headerFixed2');
            $('.moreIco').removeClass('closeIco');
        })
    })

</script>
{/block}
{block name="body"}
<div class="app_goBackToTop"></div>
<div class="app_meskSection"></div>

<div class="container">

    <div class="app_header_section2  app_scrollerHeader" id="header">
        <div class="app_header_detail2">
            <div class="app_header_back"></div>
            <div class="app_header_h1">
                签到                <a href="/personal/bookcase"> <i class="shujiaIco"></i></a>
                <i class="moreIco"></i>
            </div>
        </div>
		{include file="public/dropnav" /}
	</div>

    <div class="app_body">
        
		<div class="app_qianDaoBlock2">
			<div class="banner">
				<img src="/public/lboyue/m/images/qianDao_04.jpg" alt="" class="bannerBlock" />
				
				{if $qiandao}
					<button  class="app_centerButton">今日已签到</button>
				{else}
					<button id="qiandaobtn" class="app_centerButton">立即签到</button>
				{/if}

				

				<div class="app_tipsBlp">每日签到可获<span>{$qbegold}书币</span>奖励</div>


				<div class="app_ydjl_Buttton">
					<a href="/personal/bookcase"><i>我的阅读记录</i></a>
				</div>

				<div class="app_ydb_Button">
					<i id="mygold"><a href="/personal/info">我的书币:{$zb}</a></i>
				</div>

			</div>
		</div>


		<div class="app_listBlock  app_deleteMargin">
			<div class="app_listBlock_title  tit_icon1">
				<span class="h1">您最近在看的书</span>
			</div>
			<div class="app_listBlock_con">
				<ul id="listBlock">
					
				</ul>
			</div>

		</div>

	 {block name="include"}{include file="public:footer" /}{/block}
	</div>
</div>


{/block}
{block name="script"}
    <script type="text/javascript">
		var qiandao  = '{$qiandao|default=0}';
		var qbegold = {$qbegold};
		var expire = {:config('sign_expire')};
        var goldname="书币";
        $("#qiandaobtn").click(function () {
            if(qiandao==1)
            {
                layer.msg("您今天已经完成签到任务，明天再来吧");
                return;
            }
            $.ajax({
                url: "/personal/signin/",
                type: "POST",
                dataType: "json",
                data: {usecenter: 1},
                success: function (re) {
                    if (re.code == "1") {
                        var data=re.data;
						 layer.msg('<p>每日首次阅读, 赠送 <span style="color:orangered"> '+qbegold+'</span> 书币</p>' +
                        '<p style="margin-top:10px">请明日继续签到哦</p><p>签到赠送书币有效期为'+expire+'天</p>');
						setTimeout(function(){
								window.location.reload();
						},1000);
                    } else {
                       layer.msg("签到出现错误:"+re.msg);
                    }
                },
                error: function () {
                    layer.msg("签到出现错误,请联系管理员");
                }
            });
        });
		$.ajax({
                url      : "/api/history/getmore",
                type     : "POST",
                dataType : "json",
                data     : {},
                success  : function (re) {
                    var code = re.code;
                    switch (code)
                    {
                        case 1:
                            var data = re.data;
                            var html = "";
                            for (var i=0; i < data.length; i++) {
                                html +=' <li>';
                                html +='<a href="/book/info/id/'+data[i].id+'.html">								<div class="leftImage"><img src="'+data[i].cover+'" onerror="javascript:this.src=\'/public/novel/images/default.jpg\';"></div>								<div class="rightBlock">									<span class="rightBlock_title">'+data[i].title+'</span>									<span class="rightBlock_con">										 <span class="con">'+data[i].intro+'...</span>								</span>									<span class="rightBlock_label">									<span class="keyWord_l">										   <i class="k1">'+data[i].fullflag+'</i>									</span>									<span class="keyWord_r">										   <i class="k1">'+data[i].size+'万字</i>										   <i class="k2">'+data[i].category+'</i>									</span>								</span>								</div>							</a>						</li>';
                            }
                            $("#listBlock").html(html);
                            break;
                        default:
                            malert(re.msg, 1200, 2);
                            break;
                    }
                },
                error    : function () {
                    malert("服务器开小差了～", 1200, 2);
                    return "";
                }
            });
        </script>
{/block}


